{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form onsubmit="return false;">
                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">网站名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" value="{$data.title}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            <div class="layui-form-item" style="display:none">
                                <label class="layui-form-label">跳转appid</label>
                                <div class="layui-input-block">
                                    <input type="text" name="jump_appid" value="{$data.jump_appid}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            <div class="layui-form-item" style="display:none">
                                <label class="layui-form-label">企业微信id</label>
                                <div class="layui-input-block">
                                    <input type="text" name="corpid" value="{$data.corpid}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            <div class="layui-form-item" style="display:none">
                                <label class="layui-form-label">企业微信链接</label>
                                <div class="layui-input-block">
                                    <input type="text" name="wx_link" value="{$data.wx_link}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">物流code</label>
                                <div class="layui-input-block" style="width: 1000px">
                                    <input type="text" name="logistics_code" value="{$data.logistics_code}" lay-verify="required" class="layui-input" style="width: 850px;display: inline-block">
                                    <a  href="https://market.aliyun.com/products/57126001/cmapi021863.html?#sku=yuncode1586300000" target="_blank" class="layui-btn layui-btn-primary layui-btn-sm">购买链接</a>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">连击赏最大抽取次数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="lianji_max_num" value="{$data.lianji_max_num ? $data.lianji_max_num : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">分销奖励比例</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="fx_bili" value="{$data.fx_bili}" lay-verify="required" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    %
                                </div>
                            </div>                            
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">充值最低多少起</label>-->
<!--                                <div class="layui-input-inline">-->
<!--                                    <input type="text" name="recharge_money" value="" lay-verify="required" class="layui-input">-->
<!--                                </div>-->
<!--                                <div class="layui-form-mid layui-word-aux">-->
<!--                                    元-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">提现最低多少起</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="withdraw_money" value="{$data.withdraw_money ? $data.withdraw_money : 0}" lay-verify="required" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    元
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">提现手续费</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="withdraw_money_sxf" value="{$data.withdraw_money_sxf ? $data.withdraw_money_sxf : 0}" lay-verify="required" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    元
                                </div>
                            </div>

                          <div class="layui-form-item">
                                <label class="layui-form-label">兑换是否开启</label>
                                <div class="layui-input-inline" style="width: 700px">
                                    <input type="radio" name="dh_is_open" value="0" class="layui-input" title="关闭" {if $data.dh_is_open eq 0} checked {/if}>
                                    <input type="radio" name="dh_is_open" value="1" class="layui-input" title="开启" {if $data.dh_is_open eq 1} checked {/if}>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">赏劵每人每天最多领取多少次</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="coupon_ling_max_ci" value="{$data.coupon_ling_max_ci ? $data.coupon_ling_max_ci : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">特级赏劵限制参与人数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="coupon_a_xz_max" value="{$data.coupon_a_xz_max ? $data.coupon_a_xz_max : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">终极赏劵限制参与人数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="coupon_b_xz_max" value="{$data.coupon_b_xz_max ? $data.coupon_b_xz_max : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">高级赏劵限制参与人数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="coupon_c_xz_max" value="{$data.coupon_c_xz_max ? $data.coupon_c_xz_max : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">普通赏劵限制参与人数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="coupon_d_xz_max" value="{$data.coupon_d_xz_max ? $data.coupon_d_xz_max : 0}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">背包满多少包邮</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="free_post" value="{$data.free_post}" lay-verify="required" class="layui-input">

                                </div>
                                <label class="layui-form-label">背包发货运费</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="post_money" value="{$data.post_money}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">卡册满多少包邮</label>-->
<!--                                <div class="layui-input-inline">-->
<!--                                    <input type="text" name="card_free_post" value="" lay-verify="required" class="layui-input">-->

<!--                                </div>-->
<!--                                <label class="layui-form-label">卡册发货运费</label>-->
<!--                                <div class="layui-input-inline">-->
<!--                                    <input type="text" name="card_post_money" value="" lay-verify="required" class="layui-input">-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">一番赏三发+(秒)</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="three_time" value="{$data.three_time}" lay-verify="required" class="layui-input">

                                </div>
                                <label class="layui-form-label">一番赏五发+(秒)</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="five_time" value="{$data.five_time}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">抽卡1开启2关闭</label>-->
<!--                                <div class="layui-input-inline">-->
<!--                                    <input type="text" name="open_card" value="" lay-verify="required" placeholder = '设置1开启 2 关闭' class="layui-input">-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">福利进群二维码</label>
                                <div class="layui-input-inline">
                                    <input type="hidden" name="erweima" value="{$data['erweima']}" lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input" >
                                    <img style="float:left;width:160px;height:180px " class="" id="erweima" src="{PHP} echo imageUrl($data['erweima']){/php}">
                                </div>                                
                            </div>
                            <h3 style="margin-top: 30px;color: orangered">分享设置</h3>
                            <div class="layui-form-item">
                                <label class="layui-form-label">分享标题</label>
                                <div class="layui-input-block">
                                    <input type="text" name="share_title" value="{$data.share_title}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">分享图片</label>
                                <div class="layui-input-inline">
                                    <input type="hidden" name="share_image" value="{$data.share_image}" lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input" >
                                    <img style="float:left;width:180px; height: 180px" class="" id="share_image" src="{:imageUrl($data.share_image)}">
                                </div>
                            </div>
                            <h3 style="margin-top: 30px;color: orangered">抽奖券(拉人上限)</h3>
                            <div class="layui-form-item">
                                <label class="layui-form-label">抽奖券(拉人上限)</label>
                                <div class="layui-input-block">
                                    <input type="text" name="draw_people_num" value="{$data.draw_people_num}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                               <h3 style="margin-top: 30px;color: orangered">权益达到多少等级显示兑换按钮</h3>
                           <div class="layui-form-item">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-block">
                                    <input type="text" name="is_exchange_level" value="{$data.is_exchange_level}" lay-verify="required" class="layui-input" style="width: 850px">
                                </div>
                            </div>
                            
                            
                            <div class="layui-form-item">
                                <label class="layui-form-label">音效上传</label>
                                <div id="uploadDemo" style="margin: 20px;">
                                    <input type="file" name="video" id="uploadVideo" value="11">
                                    <!--<img id="imgurl" style="width: 0px; height:0px; margin-top: 10px;" >-->
                                       {if condition="!empty($data.yinyue)"}
                                            已上传
                                        {else /}
                                            未上传
                                        {/if}
                                <audio width="10" height="10"   id="imgurl" src = {$data.yinyue|default=''}  controls>
                                  <source src="myAudio.mp3" type="audio/mpeg">
                                  Your browser does not support the audio element.
                                </audio>
                                </div>
                            </div>
                            <input type="hidden" name="yinyue" id ="video_" value="">
                                
                            <div class="layui-form-item">
                                <label class="layui-form-label">首页是否弹窗</label>
                                <div class="layui-input-inline" style="width: 700px">
                                    <input type="radio" name="is_shou_tan" value="0" class="layui-input" title="关闭" {if $data.is_shou_tan eq 0} checked {/if}>
                                    <input type="radio" name="is_shou_tan" value="1" class="layui-input" title="开启" {if $data.is_shou_tan eq 1} checked {/if}>
                                </div>
                            </div>
                            <input type="hidden" name="key" value="{$key}">
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" onclick="return check()">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
</body>
</html>
<script type="text/javascript">
    layui.use(['layer','form','upload','element'], function(){
        var $ = layui.$;
        var upload = layui.upload;
        var element = layui.element;

        //二维码
        upload.render({
            accept:'imgurl'
            ,elem: '#erweima' //绑定元素
            ,url: '/admin/picture' //上传接口
            ,done: function(res){
                //上传完毕回调
                if(res.status == 1){ //成功
                    layer.msg("上传成功",{icon:1,time:1000},function(){
                        $("#erweima").attr("src",res.data.path);  //单图
                        $("input[name=erweima]").val(res.data.imgurl);
                    });
                }else{ //失败
                    layer.msg(res.msg,{icon:2,anim:6,time:1500});
                }
            }
            ,error: function(){
                //请求异常回调
                layer.msg('服务繁忙，请稍后再试',{icon:2,anim:6,time:1500});
            }
        });


        //预售日历
        upload.render({
            accept:'imgurl'
            ,elem: '#yushou_rili' //绑定元素
            ,url: '/admin/picture' //上传接口
            ,done: function(res){
                //上传完毕回调
                if(res.status == 1){ //成功
                    layer.msg("上传成功",{icon:1,time:1000},function(){
                        $("#yushou_rili").attr("src",res.data.path);  //单图
                        $("input[name=yushou_rili]").val(res.data.imgurl);
                    });
                }else{ //失败
                    layer.msg(res.msg,{icon:2,anim:6,time:1500});
                }
            }
            ,error: function(){
                //请求异常回调
                layer.msg('服务繁忙，请稍后再试',{icon:2,anim:6,time:1500});
            }
        });

        //分享海报
        upload.render({
            accept:'imgurl'
            ,elem: '#share_image' //绑定元素
            ,url: '/admin/picture' //上传接口
            ,done: function(res){
                //上传完毕回调
                if(res.status == 1){ //成功
                    layer.msg("上传成功",{icon:1,time:1000},function(){
                        $("#share_image").attr("src",res.data.path);  //单图
                        $("input[name=share_image]").val(res.data.imgurl);
                    });
                }else{ //失败
                    layer.msg(res.msg,{icon:2,anim:6,time:1500});
                }
            }
            ,error: function(){
                //请求异常回调
                layer.msg('服务繁忙，请稍后再试',{icon:2,anim:6,time:1500});
            }
        });
        
        
                //执行实例
        var uploadInst = upload.render({
            elem: '#uploadVideo' //绑定元素
            ,url: '/admin/upload_yinyue'
            ,accept: 'audio'
            ,before: function(obj){
                console.log(obj.pushFile()); // 将每次选择的文件追加到队列 
            }
            ,done: function(res){
                if (res.status == 1) { //成功
                    layer.msg("上传成功", {icon: 1, time: 1000}, function () {
                        $("#imgurl").attr("src", res.data.url);
                        $("input[name=video_]").val(res.data.url);
                        $("#video_").val(res.data.url);
                    });
                } else {
                    //演示失败状态，并实现重传
                    var demoText = $('#uploadVideo'); // 假设#testStatus是显示状态的元素的id
                    demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini test-reload">重试</a>');
                    // demoText.find('.test-reload').on('click', function(){
                    //     uploadInst.upload();
                    // });
                    layer.msg(res.msg, {icon: 2, anim: 6, time: 1500});
                }
            }
            ,error: function(){
                //请求异常回调
                layer.msg('上传异常');
            }
        });
        
    });

    function check(){
        var url="{:url('/admin/update')}";
        var $ = layui.$;
        var load=layer.load(2);
        $.post(url,$("form").serialize(),function(data){
            if(data.status==1){
                layer.msg(data.msg,{icon:1,time:1000},function(){
                    location.reload();
                });
            }else{
                layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
                    layer.close(load);
                });
            }
        })
    }
</script>